package Graphic;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.Graphics;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;

import javax.swing.ImageIcon;
import javax.swing.Timer;

import Main.Game;

public class Background extends Canvas{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Font f = null;
	private int flag = 100;
	private Timer t = new Timer(100, new ActionListener() {
		
		public void actionPerformed(ActionEvent arg0) {
			// TODO Auto-generated method stub
			flag*=-1;
		}
	});
	
	public Background ()
	{
		try {
			f = Font.createFont(Font.TRUETYPE_FONT, new File("font/VHOBO.TTF")).deriveFont(18f);
			f = new Font(f.getFontName(), Font.BOLD, 36);
			//GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
			//ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("font/VHOBO.TTF")));
		} catch (FontFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		//t.start();
		
	}

	public void tick()
	{
		
	}
	
	public void render(Graphics g)
	{
		//background default
		g.setColor(Color.WHITE);
		g.drawRect(0, 0, Game.WIDTH+1, Game.HEIGHT+1);
		g.setColor(new Color(49, 49, 49));
		g.fillRect(1, 1, Game.WIDTH, Game.HEIGHT);
		
		g.setColor(Color.yellow);
		g.fillRect(1, 1, 100, 600);
		g.setColor(Color.yellow);
		g.fillRect(100, 100, 500, 100);
		
		g.setFont(new Font("Comic Sans MS", Font.BOLD, 60));
		g.drawString("Game", 60, 220);
		g.setColor(Color.red);
		g.setFont(new Font(f.getFontName(), Font.BOLD, 180));
		g.drawString("Game", 50, 460);
		
		
	}
	
}
